<template>
  <div style="height: 90%; width: 100%">
    <div id="line-wrap" style="height: 100%; width: 100%"></div>
  </div>
</template>

 <script>
export default {
  name: "mixCharts",
  props: {
    principal: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  watch: {
    principal(val) {
      this.getPie(val);
    },
  },
  methods: {
    getPie(val) {
      console.log(val)
      var myChart = this.$echarts.init(document.getElementById("line-wrap"));
      var option = {
        title: {
            left: 'center',
            text: '宽带专线户均ARUP(元)',
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // 坐标轴指示器，坐标轴触发有效
            type: "shadow", // 默认为直线，可选为：'line' | 'shadow'
          },
        },
        legend: {
          data: ["存量ARUP", "增量ARUP", "总ARUP"],
          bottom: 0
        },
        grid: {
          left: "10px",
          right: "10px",
          bottom: "50px",
          containLabel: true,
        },
        xAxis: {
          data: val.xTime,
          type: "category",
          boundaryGap: true,
        },
        yAxis: {
          splitLine: {
            show: false,
          },
          axisLabel: {
            show: false,
          },
          axisTick: {
            //y轴刻度线
            show: false,
          },
          axisLine: {
            //y轴
            show: false,
          },
        },
        series: [
          {
            name: "存量ARUP",
            type: "bar",
            data: val.amt,
            barWidth : 15,//柱图宽度
            itemStyle: {
              normal: {
                color: "#C1504C",
                label: {
                  show: true,
                  position: "inside",
                  textStyle: {
                    color: "#000000",
                  },
                },
              },
            },
          },
          {
            name: "增量ARUP",
            type: "bar",
            data: val.cmt,
            barWidth : 15,//柱图宽度
            itemStyle: {
              normal: {
                color: "#9BBB58",
                label: {
                  show: true,
                  position: "inside",
                  textStyle: {
                    color: "#000000",
                  },
                },
              },
            },
          },
          {
            name: "总ARUP",
            type: "line",
            data: val.arup,
            itemStyle: {
              normal: {
                color: "#8164A3",
                label: {
                  show: true,
                  position: "top",
                  textStyle: {
                    color: "#000000",
                  },
                },
              },
            },
          },
        ],
      };
      myChart.setOption(option);
    },
  },
};
</script>

 <style>
</style>
